home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4634 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.5 KB  |  43 lines

  1. Path: kbad.eglin.af.mil!rpi!not-for-mail
  2. From: ivo.welch@AGSM.UCLA.EDU (Ivo Welch)
  3. Newsgroups: comp.lang.c++,comp.lang.c++.moderated
  4. Subject: Defining Classes and Class Functions extern: 2 Line Sample
  5. Date: 30 Jan 1996 21:26:15 -0000
  6. Organization: The Anderson School at UCLA
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: vandevod@cs.rpi.edu
  9. Message-ID: <4em2dn$kio@netlab.cs.rpi.edu>
  10. NNTP-Posting-Host: netlab.cs.rpi.edu
  11. X-Original-Date: 30 Jan 1996 21:07:55 GMT
  12.  
  13.  
  14. Why does the following not work?
  15.     class tryclass;
  16.     extern int tryclass::tryclassfun(int w);
  17. The second line produces a syntax error on gcc.  If it worked, one should 
  18. then be able to do:
  19.     extern tryclass *tryclass;
  20.     tryclass->tryclassfun(1);
  21. The advantage would be that I would not have to have the code in one file 
  22. see the entire class definition ==> effective data hiding.
  23.  
  24. Is there an equivalent recommended way of hiding many member 
  25. functions/declarations from a particular file?  I believe there are 
  26. languages that allow something like
  27.     FROM tryclass IMPURT tryclassfun
  28. which is what I really am trying to duplicate here.
  29.  
  30. Thanks for any help.  Please respond to me---I will summarize.
  31.  
  32. /ivo welch
  33.  
  34. --
  35. Ivo Welch            ivo.welch@anderson.ucla.edu
  36. Assoc Prof of Finance        Anderson GSM at UCLA
  37.     110 Westwood Plaza, Box 951481, LA CA 90095-1481
  38.  
  39.       [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
  40.       [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
  41.       [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
  42.       [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]
  43.